/*! \page crystal2qmcDoc Crystal to QMC


\section description Description

Basic usage:  crystal2qmc -o [outputroot]  [crystal output file] <br><br>
Additional options: <br><br>
-c&nbsp;&nbsp;:&nbsp;&nbsp;Work with complex k-points; the default
without this switch is to read only k-points with real-valued orbitals.<br><br>
-fort10file [filename]&nbsp;&nbsp;:&nbsp;&nbsp;Read from the output
created by the readcrys10.f utility and match the orbitals to the one
in the crystal output file. These are generally more accurate than the
ones in the output file. To use the fort10file option with Crystal98
or Crystal2003, one must use NOSYMADA in the last section of the
Crystal's input file. This turns off a feature that boosts the speed
quite a bit in certain circumstances, but mangles the wave function in
fort.10.



\section crystal_options Important options of Crystal98/Crystal2003 code

Several options have to be present in the Crystal's input file
for proper function of the crystal2qmc converter. These are listed below.

\subsection crys98 Crystal98

One needs to put the options: <br>
<pre>
COORPRT
</pre>
at the end of the geometry section, and <br>

<pre>
PRINTOUT
BASISSET
EIGENVAL
-1
EIGENVEC
-1
END
</pre>
in the third section(the one after the basis set section). 

\subsection crys03 Crystal2003

 For crystal 2003, put <br>
<pre>
PRINTOUT
EIGENVAL
-1
EIGENVEC
-100
END
</pre>
in the third section as above.  To get the correct basis set, use the
properties input: <br>
<pre>
BASISSET
0
END
</pre>
and cat the output into the end of the output file.  A script to do
this is at the bottom of this page.  The -100 under EIGENVEC prints
out the first 100 k-points used.  If you end up with more k-points,
increase the absolute value of this number.

\section FSEnote Note on finite-size errors in simulations of solids

<p>
At least for 2003 (and maybe 98), crystal2qmc can find all
k-points and prepare an input file for QWalk at non-zero
k-points. Finite size errors in the kinetic energy can be reduced by a
choice of a special single k-point (in a cubic supercell,
the 111 direction minimizes the error, for example). A more advanced
approach is to utilize averaging over the so-called twisted boundary
conditions, i.e., averaging over many k-points [Lin et al., <a
href="http://dx.doi.org/10.1103/PhysRevE.64.016702">Phys. Rev. E <b>64</b>,
016702 (2001)</a>]. In the case of the DMC method, this necessitates
the use of fixed-phase DMC (instead of fixed-node) [Ortiz et al., <a
href="http://dx.doi.org/10.1103/PhysRevLett.71.2777">Phys.
Rev. Lett. <b>71</b>, 2777 (1993)</a>], since the
wave functions at many k-points are complex. QWalk automatically
selects the proper DMC version according to the provided wave function.
</p>
<p>
Another source of finite-size errors is the long-range character of
Coulomb interaction. Rather extensive discussion of the issue is
provided in Drummond et al., <a
href="http://dx.doi.org/10.1103/PhysRevB.78.125106">Phys. Rev. B <b>78</b>,
125106 (2008)</a>. There are two approaches that go beyond Ewald
summation formula: the so-called model periodic Coulomb interaction
(MPC) and a correction based on static structure factor. The former is
not available in QWalk at present, the latter is since the evaluation
of the \ref Structure_factorDoc is implemented.
</p>


\section script Script to run Crystal2003

Make sure to put the PRINTOUT, etc in the input file..  Also, you may need to change SCRATCH, CRYSTAL, and 
PROPERTIES to reflect the location of these files/directories on your system.
<pre>
#!/bin/bash


SCRATCH=/state/partition1/scratch/$USER
if [ ! -e $SCRATCH ]
    then
    #first try to make the scratch directory.
    mkdir $SCRATCH
    #if it's still not there, error
    if [ ! -e $SCRATCH ]
    then echo "Scratch directory $SCRATCH doesn't exist and I couldn't make it"
    exit 1;
    fi
fi

CRYSTAL=/home/apps/crystal2003/crystal
PROPERTIES=/home/apps/crystal2003/properties
CURRDIR=`pwd`
echo $CURRDIR

inputfile=$(basename $1)
echo $inputfile
mkdir $SCRATCH/$inputfile
cp $1 $SCRATCH/$inputfile/

if [ -e fort.20 ]
    then cp fort.20 $SCRATCH/$inputfile
fi

cd $SCRATCH/$inputfile

$CRYSTAL < $inputfile > $CURRDIR/$inputfile.o
echo "BASISSET" > prop.in
echo "0" >> prop.in
echo "END" >> prop.in
echo "" >> prop.in
$PROPERTIES < prop.in >> $CURRDIR/$inputfile.o
cp fort.9 $CURRDIR/$inputfile.9
cp fort.10 $CURRDIR/$inputfile.10
rm -Rf $SCRATCH/$inputfile
</pre>
*/
